package belle.com.myapp.manager;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import belle.com.myapp.R;

/**
 * Title :
 * Description :
 * Author:  Belle Guan    date : 2018/6/7 14:59
 * Update :                date :
 * Version : 1.0.0
 * Copyright : copyright(c) 浙江亚厦股份有限公司 2017 ~ 2020 版权所有
 */
public class MyLinearLayoutManager {

    public static void initItemButton(LinearLayout item, String title, int icon, int iconRescoure, Class homeActivityClass, Context context) {
        ImageView imageView = item.findViewById(R.id.image);
        TextView titleContent = item.findViewById(R.id.tv_text);
        imageView.setBackgroundResource(icon);
        titleContent.setText(title);
        context.startActivity(new Intent(context, homeActivityClass));
    }

    public static void initItemButton(LinearLayout item, String title, int icon, final Class homeActivityClass, final Context context) {
        ImageView imageView = item.findViewById(R.id.image);
        TextView titleContent = item.findViewById(R.id.tv_text);
        imageView.setBackgroundResource(icon);
        titleContent.setText(title);
        item.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                context.startActivity(new Intent(context, homeActivityClass));
            }
        });

    }

    public static void initItemButton(LinearLayout item, String title, int icon) {
        ImageView imageView = item.findViewById(R.id.image);
        TextView titleContent = item.findViewById(R.id.tv_text);
        imageView.setBackgroundResource(icon);
        titleContent.setText(title);
    }
}
